package yscmd

import (
	"context"
	"gitee.com/kmyss/gf-ex/ysbuild"
	"gitee.com/kmyss/gf-ex/yslog"
)

const VERSION = "version"

type CmdVersionBuilder struct {
	CommandBuilderCore
}

func (b *CmdVersionBuilder) SetFlag(builder IFlagBuilder, _ ...string) bool {
	return false
}

func (b *CmdVersionBuilder) Init(ctx context.Context) {
	b.CommandBuilderCore.Init(ctx)
	b.C.Run = b.run
	b.C.Use = VERSION
	b.C.Short = "显示版本信息"
}

func (b *CmdVersionBuilder) SetChildCommand(builder ICommandBuilder) bool {
	return false
}

func (b *CmdVersionBuilder) run(c *Command) {
	yslog.Debug("CmdVersionBuilder Run")
	ysbuild.PrintVersion()
}
